package com.jckl.foodathon.model;

import java.util.Date;
import java.util.List;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.beoui.geocell.annotations.Geocells;
import com.beoui.geocell.annotations.Latitude;
import com.beoui.geocell.annotations.Longitude;
import com.google.appengine.api.datastore.GeoPt;
import com.google.appengine.api.datastore.Key;

@PersistenceCapable
public class Coordinate {
	
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;
	
	@Persistent
	@Latitude
	private double latitude;
	@Persistent
	@Longitude
	private double longitude;
	@Persistent
	private String locality;
	@Persistent
	private GeoPt point;
	@Persistent
	private Date queryDate;
	@Persistent
	@Geocells
	private List<String> geoCells;
	
	private int queryCount;
	
	
	public Coordinate(double latitude, double longitude, String locality){
		this.latitude = latitude;
		this.longitude = longitude;
		this.locality = locality;
		this.point = new GeoPt((float)latitude, (float)longitude);
		this.queryDate = new Date();
	}
	

	/**
	 * Getter & Setter
	 */
	
	public double getLatitude() {
		return latitude;
	}
	public void setLatitude(double latitude) {
		this.latitude = latitude;
	}
	public double getLongitude() {
		return longitude;
	}
	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}
	public Key getKey() {
		return key;
	}
	public String getLocality() {
		return locality;
	}
	public void setLocality(String locality) {
		this.locality = locality;
	}
	public GeoPt getPoint() {
		return point;
	}
	public void setPoint(GeoPt point) {
		this.point = point;
	}
	public Date getQueryDate() {
		return queryDate;
	}
	public void setQueryDate(Date queryDate) {
		this.queryDate = queryDate;
	}
	public List<String> getGeoCells() {
		return geoCells;
	}
	public void setGeoCells(List<String> geoCells) {
		this.geoCells = geoCells;
	}
	public int getQueryCount() {
		return queryCount;
	}
	public void setQueryCount(int queryCount) {
		this.queryCount = queryCount;
	}
	
}
